File manager - Edit - /home/autoph/public_html/projects/ahg-hr-api/app/Models/EmployeeChangeSchedule.php
Back
<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; // use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Notifications\Notifiable; use OwenIt\Auditing\Auditable as AuditableTrait; use OwenIt\Auditing\Contracts\Auditable; class EmployeeChangeSchedule extends Model implements Auditable { use HasFactory, SoftDeletes, AuditableTrait, Notifiable; /** * The attributes that are NOT mass assignable. * */ protected $guarded = [ 'deleted_at', ]; /** * The attributes that should be cast. * * @var array<string, string> */ protected $casts = [ 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'datetime', ]; protected $appends = [ 'lunch_break', ]; public function employee(): BelongsTo { return $this->belongsTo(Employee::class, 'employee_id', 'employee_id'); } public function recommending(): HasMany { return $this->hasMany(Employee::class, 'employee_id', 'recommending_id'); } public function approving(): HasMany { return $this->hasMany(Employee::class, 'employee_id', 'approver_id'); } public function getLunchBreakAttribute() { return LunchBreakSetting::where(['schedule_from_time' => $this->from_time, 'schedule_to_time' => $this->to_time])->select('start_break_time','end_break_time')->first(); } }
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0 |
proxy
|
phpinfo
|
Settings